import 'package:flutter/material.dart';

class MyApp12 extends StatelessWidget {
  MyApp12({super.key});
  // 1. 提供的数据
  final Map goods = {
    'createTime': "2024-08-15 21:49:48",
    'orderState': "待发货",
    'image':
        "https://yanxuan-item.nosdn.127.net/a09de222ed32efa8ffe359b1d5780574.jpg",
    'name': "茶水分离杯耐热隔热玻璃杯茶水分离杯耐热隔热玻璃杯",
    'totalNum': 2,
    'curPrice': 119.5,
    'attrsText': "规格: 白色240ml",
  };
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          '案例-商品订单信息',
          style: TextStyle(color: Colors.black, fontSize: 20),
        ),
        backgroundColor: Colors.red,
        centerTitle: false,
      ),
      body: Container(
        padding: EdgeInsets.all(10),
        width: MediaQuery.of(context).size.width,
        child: Column(
          children: [
            // 1.上部分
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  '${goods['createTime']}',
                  style: TextStyle(color: Colors.grey),
                ),
                Text(
                  '${goods['orderState']}',
                  style: TextStyle(color: Colors.orange),
                ),
              ],
            ),
            SizedBox(height: 10),
            //2.中间部分
            Row(
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                Image.network('${goods['image']}', width: 80, height: 80),
                SizedBox(width: 10),
                Expanded(
                  flex: 1,
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        '${goods['name']}',
                        style: TextStyle(
                          fontSize: 16,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      SizedBox(height: 5),
                      Text(
                        '${goods['attrsText']}',
                        style: TextStyle(color: Colors.grey),
                      ),
                      SizedBox(height: 5),
                      Text(
                        '¥${goods['curPrice']}',
                        style: TextStyle(
                          color: Colors.red,
                          fontSize: 16,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                    ],
                  ),
                ),
                Text('x${goods['totalNum']}'),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
